package com.mo.lib.http

import com.drake.net.convert.JSONConvert
import com.google.gson.Gson
import java.lang.reflect.Type

/**
 * @ author：mo
 * @ data：2021/10/8:14:58
 * @ 功能：
 */
class GsonConverter : JSONConvert() {
    private val gson = Gson()
    fun toJson(value: Any?): String? {
        return gson.toJson(value)
    }
    override fun <R> String.parseBody(succeed: Type): R? {
        return gson.fromJson(this, succeed)
    }
}